#ifndef _MAIN_WX_WINDOW_H_
#define _MAIN_WX_WINDOW_H_


// For compilers that support precompilation, includes "wx/wx.h".
//#include "wx/wxprec.h"

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP
  #include "wx/wx.h"
#endif

//#include "WindowFV.h"
//#include "wxOpenGL.h"

//#include "wx/defs.h"
//#include "wx/frame.h"
#include "wx/toolbar.h"
//#include "wx/docview.h"
/* Core dependecies */
//#include "ViewManager.h"
//#include "ModelControler.h"

class wxFileHistory;
class wxToolBarToolBase;
class wxToolBarBase;


namespace FemViewer {

class ViewManager;
class ModelCtrl;
namespace WxGUI     {
// Forword declarations
class wxRenderCanvas;

class wxMainWindow : /*public mfvWindow,*/ public  wxFrame
{
  public:
	static bool m_shutdown;

  public:
	/// Constructor & destructor
	wxMainWindow(const int posX,const int posY,
			   	 const int width,const int height,
			   	 const wxChar * title);
	~wxMainWindow(void);

	void DoInit(int cmd = 0);

	bool Show(bool show = true) {
		return  wxWindow::Show(show);
	}

	int Run(void) { return(0); }

private:
	// Handle to Viewmnager
	ViewManager			*m_pVMngr;
	// Handle to model controler
	ModelCtrl			*m_pMCtrl;
	/// Status bar
	wxStatusBar			*m_status;
	// the search tool, initially NULL
	wxToolBarToolBase	*m_searchTool;
	/// OpenGL context
	wxRenderCanvas		*m_ptrGL;
	#ifndef _USE_FV_LIB
	wxFileHistory		*m_fhistory;
	#endif
private:
	/// Keyboard service
	void OnChar(wxKeyEvent& event);
	// Menu File
	#ifndef _USE_FV_LIB
	void OnMenuFileOpen(wxCommandEvent& event);
	#endif
	void OnMenuFileRefresh(wxCommandEvent& event);
	void OnMenuFileReload(wxCommandEvent& event);
	void OnMenuFileReset(wxCommandEvent& event);
	void OnMenuFileHistory(wxCommandEvent& event);
	void OnMenuFileQuit(wxCommandEvent& event);

	// Menu View
	void OnMenuViewProjection(wxCommandEvent& event);
	void OnMenuChangeView(wxCommandEvent& event);
	void OnMenuViewMode(wxCommandEvent& event);
	void OnMenuViewNew(wxCommandEvent& event);
	void OnMenuViewNext(wxCommandEvent& event);
	void OnMenuViewPrevious(wxCommandEvent& event);
	void OnMenuViewDumpCurr(wxCommandEvent& event);
	void OnMenuViewDumpAll(wxCommandEvent& event);

	// Menu Configuraztion
	void OnMenuConfigAxes(wxCommandEvent& event);
	void OnMenuConfigGrid(wxCommandEvent& event);
	void OnMenuConfigBkgColor(wxCommandEvent& event);
	void OnMenuConfigLight(wxCommandEvent& event);
	void OnMenuConfigReset(wxCommandEvent& event);
	void OnMenuConfigSave(wxCommandEvent& event);
	void OnMenuConfigLegendEdit(wxCommandEvent& event);
	void OnMenuConfigModuleApprox(wxCommandEvent& event);
	
	// Menu Render 
	void OnMenuRenderSolutionSettings(wxCommandEvent& event);
	void OnMenuRenderDraw(wxCommandEvent& event);
	void OnMenuRenderDumpScreen(wxCommandEvent& event);
	void OnMenuRenderSettings(wxCommandEvent& event);
	void OnMenuRenderCutPlaneParams(wxCommandEvent& event);

	// Menu Help
	void OnMenuHelpAbout(wxCommandEvent& event);

	// Toolbar event funcrions
	void OnToolLeftClick(wxCommandEvent& event);
	//void GetFilePath(wxString& file_path, int file_type);
	void ScreenShot(const wxString& path);
	void OnIdle(wxIdleEvent &event);
	void OnCloseWindow(wxCloseEvent & event);
	//void OnResizeWindow(wxSizeEvent & event);
	// To managed with toolbar
	void CreateWndToolBar();
	void PopulateToolbar(wxToolBarBase* toolBar);

	// Set text on the frame bar
	void SetTitle(const wxString& title);

	DECLARE_NO_COPY_CLASS(wxMainWindow)
	DECLARE_EVENT_TABLE()


};

} // end namespace WxGUI
} // end namespace FemViewer
#endif /* _MAIN_WX_WINDOW_H_
*/
